package 二叉树;

import 二叉树.遍历.DLR;
import 二叉树.遍历.LDR;
import 二叉树.遍历.LRD;

public class Test {

    public static void main(String[] args) {
        TreeNode t1 = new TreeNode(4);

        TreeNode t2 = new TreeNode(2);
        TreeNode t3 = new TreeNode(6);

        TreeNode t4 = new TreeNode(1);
        TreeNode t5 = new TreeNode(3);

        TreeNode t6 = new TreeNode(5);
        TreeNode t7 = new TreeNode(7);

        t1.left = t2;
        t1.right = t3;

        t2.left = t4;
        t2.right = t5;

        t3.left = t6;
        t3.right = t7;

        // 测试先序遍历
        DLR.traversal(t1);
        System.out.println();
        DLR.preorderTraversal(t1);

        System.out.println();
        System.out.println();

        // 测试递归的中序遍历
        LDR.traversal(t1);
        System.out.println();
        LDR.midTraversal(t1);

        System.out.println();
        System.out.println();

        // 测试递归的后序遍历
        LRD.traversal(t1);
        System.out.println();
        LRD.postTraversal(t1);
    }
}
